package tr.edu.metu.is.mega.client;

import tr.edu.metu.is.mega.client.menu.MenuBuilderMenuBar;

import com.extjs.gxt.ui.client.Style.LayoutRegion;
import com.extjs.gxt.ui.client.util.Margins;
import com.extjs.gxt.ui.client.widget.ContentPanel;
import com.extjs.gxt.ui.client.widget.LayoutContainer;
import com.extjs.gxt.ui.client.widget.layout.BorderLayout;
import com.extjs.gxt.ui.client.widget.layout.BorderLayoutData;
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
import com.extjs.gxt.ui.client.widget.menu.MenuBar;

/**
 * Header panel of main screen.
 */
public class HeaderPanel extends ContentPanel {

    /**
     * Default constructor.
     */
    public HeaderPanel() {
        setHeaderVisible(false);
        setBorders(false);
        setBodyBorder(false);
        setLayout(new BorderLayout());

        LayoutContainer panelBanner = new LayoutContainer();
        panelBanner.setLayout(new FitLayout());

        SessionInformationPanel panelSession = new SessionInformationPanel();

        BorderLayoutData layoutDataRight = new BorderLayoutData(LayoutRegion.EAST);
        layoutDataRight.setSplit(false);
        layoutDataRight.setSize(300);
        layoutDataRight.setCollapsible(false);
        layoutDataRight.setMargins(new Margins(0, 3, 0, 0));
        this.add(panelSession, layoutDataRight);

        BorderLayoutData layoutDataSouth = new BorderLayoutData(LayoutRegion.CENTER);
        layoutDataSouth.setSplit(false);
        layoutDataSouth.setCollapsible(false);
        MenuBar menuBar = new MenuBar();
        MenuBuilderMenuBar menuBuilder = new MenuBuilderMenuBar(menuBar, this);
        menuBuilder.buildMenu();
        this.add(menuBar, layoutDataSouth);
    }
}
